package com.lagou.config;

import com.lagou.intercepter.AuthInfoInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {


//    @Bean
//    public AuthorityInterceptor AuthorityInterceptor() {
//        return new AuthorityInterceptor();
//    }


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new AuthInfoInterceptor()) //拦截器注册对象
                .addPathPatterns("/user/login/**"); //指定要拦截的请求
//                .excludePathPatterns("/user/login"); //排除请求
    }
}
